//
// Created by Administrator on 2023/5/23.
//
#pragma once
#include "../../Dialog/LDF_Dialog/header/LDF_Dialog.h"
#include "../Qss/Create_Table_Q.h"
#include "../../New_Table/header/New_Table.h"
#include <QPushButton>
#include <QLabel>
#include <QLineEdit>


#ifndef CREATE_TABLE_H
#define CREATE_TABLE_H


class Create_Table: public LDF_Dialog
{
    Q_OBJECT
public:
    Create_Table();


    Create_Table(New_Table* new_table);


    ~Create_Table();


    template<typename Entrust>
    void Control_Profile(Entrust* entrust, QString object_name, QString control_qss, int width, int height, int x_pos, int y_pos, QString text);


    QPushButton* Get_O_B();
    QPushButton* Get_G_B();


    QLineEdit* Get_R_E();
    QLineEdit* Get_C_E();


    void Set_Table_Object(New_Table* temp_table);


public slots:
    void Table_Size()
    {
        qint32 temp_rows {this->rows_edit->text().toInt()};
        qint32 temp_columns {this->columns_edit->text().toInt()};

        this->new_table->Set_Table_Size(temp_rows, temp_columns);
    }





private:
    New_Table* new_table;


    QPushButton* ok_button;
    QPushButton* go_back_button;


    QLabel* rows;
    QLabel* columns;


    QLineEdit* rows_edit;
    QLineEdit* columns_edit;
};


template<typename Entrust>
void Create_Table::Control_Profile(Entrust *entrust
                                   , QString object_name, QString control_qss
                                   , int x_pos, int y_pos,
                                   int width, int height
                                   , QString text)
{
    entrust->setParent(this);
    entrust->setObjectName(object_name);
    entrust->setStyleSheet(control_qss);
    entrust->resize(width, height);
    entrust->move(x_pos, y_pos);
    entrust->setText(text);
}






#endif //CREATE_TABLE_H
